package examples.webstore;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import examples.webstore.domainobject.Product;
import examples.webstore.domainobject.User;


/**
 * <p> Represents the in-memory database for the application.
 * 
 * @author Maqbool Khan
 * @since jdk 1.5
 * @see
 */
/**
 *
 * @author Maqbool Khan
 * @since jdk 1.5
 * @see
 */
public class Database {
	
	static public List<Product> products = new ArrayList<Product>();
	static public Map<String, User> users = new HashMap<String, User>();
	
	/**
	 * create the datbase
	 */
	static	{
		
		User user1 = new User("Maqbool", "password", "address", 55901);
		User user2 = new User("James Gosling", "java", "xyz, CA", 56301);
		User user3 = new User("Bjarne Stroustrup", "c++", "xyz, CA", 56301);
		User user4 = new User("Grady Booch", "oo", "xyz CA", 55901);
		users.put("Maqbool", user1);
		users.put("James Gosling", user2); 
		users.put("Bjarne Stroustrup", user3);
		users.put("Grady Booch", user4);
		
		Product product1 = new Product("Java", "Programming language", 3000, user2);
		Product product2 = new Product("C++", "Programming language", 2000, user3);
		Product product3 = new Product("Websphere", "J2EE application server", 5000, user1);
		Product product4 = new Product("Weblogic", "J2EE application server", 4000, user1);
		Product product5 = new Product("Rational Rose", "Modeling tool", 5000, user4);
		
		products.add(product1);
		products.add(product2);
		products.add(product3); 
		products.add(product4);
		products.add(product5);
	}
	
	
}
